CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(Robots CXX)  

# options
OPTION(WITH_X11 "build with x11" ON)

IF (WITH_X11)
    ADD_DEFINITIONS("-DWITH_X11")
ENDIF(WITH_X11)

# find dependencies
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")

# gamcs
FIND_PACKAGE(GAMCS REQUIRED)
INCLUDE_DIRECTORIES($GAMCS_INCLUDE_DIR})
SET(LIBS ${LIBS} ${GAMCS_LIBRARY})

# ode
FIND_PACKAGE(ODE REQUIRED)
INCLUDE_DIRECTORIES(${ODE_INCLUDE_DIR})
SET(LIBS ${LIBS} ${ODE_LIBRARY})

# drawstuff should be set before OpenGL stuff
# include directory
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/include)
# library directory
LINK_DIRECTORIES(${PROJECT_SOURCE_DIR}/libs)
SET(LIBS ${LIBS} drawstuff)

# OpenGL
FIND_PACKAGE(OpenGL REQUIRED)
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
SET(LIBS ${LIBS} ${OPENGL_glu_LIBRARY} ${OPENGL_gl_LIBRARY})

# compile flags
    SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Wextra -Wno-write-strings -g -std=c++0x")
    SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -Wall -Wextra -Wno-write-strings -std=c++0x")

# compile flags, Release by default
IF (NOT CMAKE_BUILD_TYPE)
    SET(CMAKE_BUILD_TYPE Release)
ENDIF()

# subdirectories
ADD_SUBDIRECTORY(BiRob)
ADD_SUBDIRECTORY(MyDog)
